﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using IHISCETeim.Model;

namespace IHISCETeim.Web.MachineSys.PartsModel
{
    public partial class PartsRankSelect : PageBase
    {
        protected string target
        {
            get
            {
                return GetRequestValue<string>("target", "");
            }
        }
        protected string rel
        {
            get
            {
                return GetRequestValue<string>("rel", "");
            }
        }

        protected override string orderField
        {
            get
            {
                return string.IsNullOrEmpty(base.orderField) ? "RId" : base.orderField;
            }
        }
        protected override string orderDirection
        {
            get
            {
                return string.IsNullOrEmpty(base.orderDirection) ? "DESC" : base.orderDirection;
            }
        }

        protected string CardName
        {
            get
            {
                return GetRequestValue<string>("CardName","");

            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            DataBind();
        }
        protected string GetSql()
        {
            string wheresql = "";


            string ItemCodeSQL = "";
            if (!string.IsNullOrEmpty(CardName))
            {
                ItemCodeSQL = string.Format(" CardName LIKE '%{0}%'", CardName);
                wheresql = (string.IsNullOrEmpty(wheresql) ? "" : "and ") + ItemCodeSQL;

            }
            return wheresql;
        }
        protected void DataBind()
        {
            this.rpMenu.DataSource = PartsRankController.GetPagination(GetSql(), pageNum, numPerPage, SQLSort, ref TotalCount);
            this.rpMenu.DataBind();
        }

        protected override string DWZRef
        {
            get { return ""; }
        }
    }
}